import {useState, useCallback} from 'react'
import {genFieldTypeList} from "@/services/gen/api";

export default () => {
  const [javaFieldTypeList, setJavaFieldTypeList] = useState();

  const getJavaFieldType = useCallback(() => {
    genFieldTypeList("").then(res => {
      const newJavaFieldList = {};
      res.data.forEach(item =>{
        newJavaFieldList[item.name] =  item.name
      })
      setJavaFieldTypeList(newJavaFieldList);
    })
  }, [])


  return {
    javaFieldTypeList,
    getJavaFieldType,
  }
}
